

import java.sql.Driver;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class autoTest {
	
	
	public void run() {
		System.setProperty("webdriver.chrome.driver", "driver/chromedriver.exe");
		WebDriver driver=new ChromeDriver();
		driver.get("https://www.baidu.com");
		clickMe(driver, "div#u1 a[name='tj_settingicon']");
		clickMe(driver, "label[for='SL_1']");
		clickMe(driver, "label[for='SL_1']");
		clickMe(driver, "input#save");
		Alert alert=driver.switchTo().alert();
		alert.accept();
		
	}
	private void clickMe(WebDriver driver,String CssPath) {
		driver.findElement(By.cssSelector(CssPath)).click();
	}
	
}
